package com.bestcem.xm.txtanls.controller.convert;

import cn.hutool.core.collection.CollUtil;
import com.bestcem.xm.txtanls.controller.vo.model.TrainModelVO;
import com.bestcem.xm.txtanls.entity.mysql.TrainModelDo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author liheng
 * @version v1.0
 * @date 2022/3/9 17:35
 */

public class TrainModelConvert {
    private TrainModelConvert() {
    }

    public static TrainModelVO convertVo(TrainModelDo trainModel) {
        TrainModelVO trainModelVO = new TrainModelVO();
        trainModelVO.setModelId(trainModel.getTrainModelId());
        trainModelVO.setName(trainModel.getName());
        trainModelVO.setCode(trainModel.getCode());
        return trainModelVO;
    }

    public static List<TrainModelVO> convertVoList(List<TrainModelDo> trainModels) {
        List<TrainModelVO> trainModelVOS = new ArrayList<>(10);
        if (CollUtil.isEmpty(trainModels)){
            return trainModelVOS;
        }

        for (TrainModelDo trainModel : trainModels) {
            trainModelVOS.add(convertVo(trainModel));
        }
        return trainModelVOS;
    }
}
